package com.hzcx.app.simplechat.ui.setting.presenter;

import android.content.Context;

import com.hzcx.app.simplechat.api.BaseDialogObserver;
import com.hzcx.app.simplechat.api.BaseObserver;
import com.hzcx.app.simplechat.base.BaseEmptyBean;
import com.hzcx.app.simplechat.base.BasePresenter;
import com.hzcx.app.simplechat.model.SettingModel;
import com.hzcx.app.simplechat.model.UserModel;
import com.hzcx.app.simplechat.ui.setting.bean.BlackListBean;
import com.hzcx.app.simplechat.ui.setting.bean.GroupMessageListBean;
import com.hzcx.app.simplechat.ui.setting.contract.BlackListContract;
import com.hzcx.app.simplechat.ui.setting.contract.GroupMessageListContract;

import java.util.List;

public class GroupMessageListPresenter extends BasePresenter<GroupMessageListContract.View> implements GroupMessageListContract.Presenter {

    /**
     *  获取群发助手列表
     * @param context
     * @param page
     */
    @Override
    public void getGroupMessageList(Context context, int page) {
        SettingModel.getGroupMessageList(context, page, new BaseObserver<List<GroupMessageListBean>>() {
            @Override
            protected void onSuccess(List<GroupMessageListBean> data) {
                mView.groupMessageResult(data);
            }

            @Override
            public void onFailure(Throwable e, String errorMsg) {
                super.onFailure(e, errorMsg);
                mView.onFail();
            }
        });
    }

    /**
     *  清空群发记录
     * @param context
     */
    @Override
    public void clearGroupMessage(Context context) {
        SettingModel.clearGroupMessage(context, new BaseDialogObserver<BaseEmptyBean>(context) {
            @Override
            protected void onSuccess(BaseEmptyBean data) {
                mView.clearSuccess();
            }
        });
    }
}
